<?php
/**
 * Created by PhpStorm.
 * User: chenxiaogang
 * Date: 2017/12/6
 * Time: 11:40
 */

namespace User\Model;


use Common\Model\CommonModel;

class ReportOrders extends CommonModel
{
    protected $connection = 'DB_CONFIG2';
    protected $trueTableName = 'report_orders';

    /**
     * @use          [订单综合统计表列表]
     * @author       chenxiaogang
     * @param $where
     * @param $limit
     * @return mixed
     */
    public function getList($where,$limit)
    {
        $fields = '';
        $data = $this->field($fields)->where($where)->limit($limit)->select();
        return $data;
    }

    /**
     * @use          [订单综合统计表总条数]
     * @author       chenxiaogang
     * @param $where
     * @return mixed
     */
    public function getCount($where)
    {
        $count = $this->where($where)->count('id');
        return $count;
    }

    public static function get_overdue_m_status_text($key,$returnAll = false)
    {
        $status = [
            null => '待审核',
            0 => '',
            1 => 'M1',
            2 => 'M2',
        ];
        if($returnAll){
            return $status;
        }
        if(!array_key_exists( $key, $status )) {
            return '未知状态';
        }
        return $status[(int)$key];
    }

}